﻿@using Model;
@{
    ViewBag.Title = "编辑分类";
    ViewBag.TagCss = "active";
    Category m = ViewBag.model;
}
<ul class="breadcrumb">
    <li>分类管理<span class="divider">/</span></li>
    <li class="active">@ViewBag.Title</li>
</ul>
<div class="container-fluid">
    <div class="row-fluid">

        <div class="row-fluid">

            <div class="btn-toolbar">
                <button class="btn btn-primary" onclick="save()"><i class="fa fa-save"></i> Save</button>
                <div class="btn-group">
                </div>
            </div>
            <div>
                <label>分类名称</label>
                <input type="text" id="name" name="name" style="width:400px;" value="@m.cate_name">
                <label>分类摘要</label>
                <textarea id="mate" name="mate" style="width:400px;height:300px;">@m.cate_mate</textarea>
                <input type="hidden" id="cateid" value="@m.cate_id" />
            </div>
        </div>



        @Html.Partial("_footer")

    </div>
</div>


<script>

    //保存
    function save()
    {
        var name = $("#name").val();
        if (name == "")
        {
            AlertDialog("名称不能为空！");
            return;
        }

        var data = [{ 'name': 'name', 'value': name },
            { 'name': 'mate', 'value': $("#mate").val() },
            { 'name': 'cateid', 'value': $("#cateid").val() }
        ];
        AjaxPost('/Admin/Cate/Save', data, function (mess) {
            AlertDialog(mess.msg, function () {
                if(mess.code==200)
                {
                    location.href = "/Admin/Cate/List";
                }
            });
        });
    }
</script>

